<?php
require_once $ubi['SERVER']['SERVER_ROOT'] . "/controller/ctlAbstract.php";
require_once $ubi['SERVER']['SERVER_ROOT'] . '/business/busUser.php';

/**
 * This is the class handle the validation for the website
 */
class ValidateController extends AbstractController {	
	private $userBus;	
	
	public function main(array $getVars) {
		if (!isset($userBus)) {
			$this->userBus = new UserBus();
		}
		
		if (isset($getVars['username'])) {			
			echo $this->userBus->isExistedByUserName($getVars['username']);
		} else if (isset($getVars['email'])) {
			echo $this->userBus->isExistedByEmail($getVars['email']);
		}
	}
}
?>